# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=materia-gtk-theme
pkgver=20200422
_commit=b36b379c9256b67e5f63a60c6faf6912f1845b66
pkgrel=2
pkgdesc="Material Design theme for GNOME/GTK desktops"
options="!check" # It is a theme
url="https://github.com/nana-4/materia-theme"
arch="noarch !s390x !mips !mips64"
license="GPL-2.0-only"
makedepends="meson sassc"
subpackages="
	materia:_materia:noarch
	materia-gtk3:_gtk3:noarch
	materia-gtk2:_gtk2:noarch
	materia-gnome-shell:_gnome_shell:noarch
	materia-chromium:_chromium:noarch

	materia-compact:_materia_compact:noarch
	materia-compact-gtk3:_gtk3_compact:noarch
	materia-compact-gtk2:_gtk2_compact:noarch
	materia-compact-gnome-shell:_gnome_shell_compact:noarch
	materia-compact-chromium:_chromium_compact:noarch

	materia-dark:_dark:noarch
	materia-dark-gtk3:_dark_gtk3:noarch
	materia-dark-gtk2:_dark_gtk2:noarch
	materia-dark-gnome-shell:_dark_gnome_shell:noarch
	materia-dark-chromium:_dark_chromium:noarch

	materia-dark-compact:_dark_compact:noarch
	materia-dark-compact-gtk3:_dark_compact_gtk3:noarch
	materia-dark-compact-gtk2:_dark_compact_gtk2:noarch
	materia-dark-compact-gnome-shell:_dark_compact_gnome_shell:noarch
	materia-dark-compact-chromium:_dark_compact_chromium:noarch
	"
source="$pkgname-$_commit.tar.gz::https://github.com/nana-4/materia-theme/archive/$_commit.tar.gz
	fix-align.patch::https://github.com/tuberry/materia-theme/commit/79a9fe8738615d8641900ef1067dd9d1fcc295de.patch
	"
builddir="$srcdir/materia-theme-$_commit"

build() {
	meson \
		--prefix=/usr \
		--buildtype=plain \
		-Dgnome_shell_version=3.36 \
		. output
	ninja -C output
}

package() {
	DESTDIR="$pkgdir" ninja -C output install

	rm -rf "$pkgdir"/usr/share/themes/*/xfwm4
	rm -rf "$pkgdir"/usr/share/themes/*/cinnamon
	rm -rf "$pkgdir"/usr/share/themes/*/plank
	rm -rf "$pkgdir"/usr/share/themes/*/unity
	rm -rf "$pkgdir"/usr/share/themes/*/metacity-1
	rm -rf "$pkgdir"/usr/share/themes/*/COPYING

	# Remove those and make a package for them if you want
	# and make a merge request in the Alpine Linux gitlab
	rm -rf "$pkgdir"/usr/share/themes/Materia-light-compact
	rm -rf "$pkgdir"/usr/share/themes/Materia-light
}

_dark_compact() {
	pkgdesc="Dark compact version of Materia"
	depends="gnome-themes-extra gtk-murrine-engine"
	amove usr/share/themes/Materia-dark-compact/index.theme
}

_dark_compact_gtk3() {
	pkgdesc="GTK+3.0 assets for dark compact version of Materia"
	depends=""
	install_if="materia-dark-compact=$pkgver-r$pkgrel gtk+3.0"

	amove usr/share/themes/Materia-dark-compact/gtk-3.0
}

_dark_compact_gtk2() {
	pkgdesc="GTK+2.0 assets for dark compact version of Materia"
	depends=""
	install_if="materia-dark-compact=$pkgver-r$pkgrel gtk+2.0"

	amove usr/share/themes/Materia-dark-compact/gtk-2.0
}

_dark_compact_gnome_shell() {
	pkgdesc="GNOME Shell assets for dark compact version of Materia"
	depends=""
	install_if="materia-dark-compact=$pkgver-r$pkgrel gnome-shell"

	amove usr/share/themes/Materia-dark-compact/gnome-shell
}

_dark_compact_chromium() {
	pkgdesc="Chromium theme based on dark compact version of Materia"
	depends=""
	install_if="materia-dark-compact=$pkgver-r$pkgrel chromium"

	amove usr/share/themes/Materia-dark-compact/chrome
}

_dark() {
	pkgdesc="Dark version of Materia"
	depends="gnome-themes-extra gtk-murrine-engine"
	amove usr/share/themes/Materia-dark/index.theme
}

_dark_gtk3() {
	pkgdesc="GTK+3.0 assets for dark version of Materia"
	depends=""
	install_if="materia-dark=$pkgver-r$pkgrel gtk+3.0"

	amove usr/share/themes/Materia-dark/gtk-3.0
}

_dark_gtk2() {
	pkgdesc="GTK+2.0 assets for dark version of Materia"
	depends=""
	install_if="materia-dark=$pkgver-r$pkgrel gtk+2.0"

	amove usr/share/themes/Materia-dark/gtk-2.0
}

_dark_gnome_shell() {
	pkgdesc="GNOME Shell assets for dark version of Materia"
	depends=""
	install_if="materia-dark=$pkgver-r$pkgrel gnome-shell"

	amove usr/share/themes/Materia-dark/gnome-shell
}

_dark_chromium() {
	pkgdesc="Chromium theme based on dark version of Materia"
	depends=""
	install_if="materia-dark=$pkgver-r$pkgrel chromium"

	amove usr/share/themes/Materia-dark/chrome
}

_materia() {
	pkgdesc="Materia theme"
	depends="gnome-themes-extra gtk-murrine-engine"
	amove usr/share/themes/Materia/index.theme
}

_gtk3() {
	pkgdesc="GTK+3.0 assets for Materia"
	depends=""
	install_if="materia=$pkgver-r$pkgrel gtk+3.0"

	amove usr/share/themes/Materia/gtk-3.0
}

_gtk2() {
	pkgdesc="GTK+2.0 assets for Materia"
	depends=""
	install_if="materia=$pkgver-r$pkgrel gtk+2.0"

	amove usr/share/themes/Materia/gtk-2.0
}

_gnome_shell() {
	pkgdesc="GNOME Shell assets for Materia"
	depends=""
	install_if="materia=$pkgver-r$pkgrel gnome-shell"

	amove usr/share/themes/Materia/gnome-shell
}

_chromium() {
	pkgdesc="Chromium theme based on Materia"
	depends=""
	install_if="materia=$pkgver-r$pkgrel chromium"

	amove usr/share/themes/Materia/chrome
}

_materia_compact() {
	pkgdesc="Compact Materia theme"
	depends="gnome-themes-extra gtk-murrine-engine"
	amove usr/share/themes/Materia-compact/index.theme
}

_gtk3_compact() {
	pkgdesc="GTK+3.0 assets for compact Materia"
	depends=""
	install_if="materia-compact=$pkgver-r$pkgrel gtk+3.0"

	amove usr/share/themes/Materia-compact/gtk-3.0
}

_gtk2_compact() {
	pkgdesc="GTK+2.0 assets for compact Materia"
	depends=""
	install_if="materia-compact=$pkgver-r$pkgrel gtk+2.0"

	amove usr/share/themes/Materia-compact/gtk-2.0
}

_gnome_shell_compact() {
	pkgdesc="GNOME Shell assets for compact Materia"
	depends=""
	install_if="materia-compact=$pkgver-r$pkgrel gnome-shell"

	amove usr/share/themes/Materia-compact/gnome-shell
}

_chromium_compact() {
	pkgdesc="Chromium theme based on compact Materia"
	depends=""
	install_if="materia-compact=$pkgver-r$pkgrel chromium"

	amove usr/share/themes/Materia-compact/chrome
}
sha512sums="136372f07be77a9a682a6194d9a9f4f5c686db27250ad6d4e4777261bf04f4986fc0dfcf6835514824b1b4ac3f078bb147a210064196fac85931e3d90760e6c7  materia-gtk-theme-b36b379c9256b67e5f63a60c6faf6912f1845b66.tar.gz
715ec8e8b61c8b1921ed59529a0a2fbbd08e06dfb5cf5e42404b97c955f045c9e89381005e1b77fad4a5b7a4d3625c2a7d9d27ee568f5e79d266113572c53bac  fix-align.patch"
